// ml:run = $bin < input
#include <iostream>
#include <iomanip>

int const upper = 700;
double dp[2][upper + 4];
int n, k;

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin >> n >> k;
    int prev = 1, now = 0;
    for (int i = 1; i <= n; i++) {
        std::swap(prev, now);
        for (int j = 1; j < upper; j++) {
            double t1 = dp[prev][j];
            double t2 = dp[prev][j + 1];
            dp[now][j] = (j * t1 + t2 + j * (j + 3) / 2) / (double)(k * (j + 1));
            dp[now][j] += t1 * (k - 1) / (double)k;
        }
    }
    auto ans = dp[now][1] * k;
    std::cout << std::fixed << std::setprecision(11) << ans << "\n";
}

